home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / oasis / oasisegs.lha / egs / lips.sml < prev    next >
Text File  |  1992-04-23  |  339b  |  12 lines

  1. fun run 0 = 0
  2.   | run n = rev () andalso run (n-1)
  3.  
  4. fun rev () = reverse [1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
  5.                       1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
  6.                       1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
  7.  
  8. fun reverse []    = []
  9.   | reverse x::xs = append (reverse xs) [x]
  10.  
  11. fun append [] ys    = ys
  12.   | append x::xs ys = x::append xs ys